#ifndef _COMMAND_H_
#define _COMMAND_H_

#include "public.h"
#include <string>

using namespace std;

struct CommandTable
{
    string cmd;
    void (*cmd_handler)(int sockfd, string &input);
};

void cmd_ls_handler(int sockfd, string &input);
void cmd_rm_handler(int sockfd, string &input);
void cmd_cd_handler(int sockfd, string &input);
void cmd_download_handler(int sockfd, string &input);
void cmd_upload_handler(int sockfd, string &input);

// 表驱动执行命令对应的方法
static CommandTable cmdTable[] =
{
    {"ls", cmd_ls_handler},
    {"cmd", cmd_cd_handler},
    {"rm", cmd_rm_handler},
    {"upload", cmd_upload_handler},
    {"download", cmd_download_handler}
};

#endif